package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.common.vo.eduEnrollmenBrochure.EnrollmenVO;
import com.jwsoft.manager.common.vo.eduFormEnroll.EduFormEnrollKeyVO;
import com.jwsoft.manager.common.vo.eduFormEnroll.EduFormEnrollSchoolVO;
import com.jwsoft.manager.common.vo.eduFormEnroll.EduFormEnrollVO;
import com.jwsoft.manager.common.vo.eduFormEnroll.SelectableConfigName;
import com.jwsoft.manager.common.vo.eduFormSpecial.EduFormSpecialVO;
import com.jwsoft.manager.core.integration.EduEnrollmenBrochureJhIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 各学校招生简章网关
 *
 * @author chenchao
 * @since 2023-01-11
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "各学校招生简章", description = "各学校招生简章")
public class EduEnrollmenBrochureJhController {

    @Autowired
    public EduEnrollmenBrochureJhIntegration eduEnrollmenBrochureJhIntegration;
    @Operation(summary = "新增或更新招生方案",description = "新增或更新招生方案")
    @PostMapping(value = "/EduenrollmenJh0011", produces = "application/json;charset=UTF-8")
    public AppResponse saveEnroll(@RequestBody @Validated EnrollmenVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureJhIntegration.saveEnroll(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育关联特殊通道表单",description = "义务教育关联特殊通道表单")
    @PostMapping(value = "/EduenrollmenJh0013", produces = "application/json;charset=UTF-8")
    public AppResponse saveYwSpecialFormInfo(@RequestBody @Validated EduFormSpecialVO vo) {
        eduEnrollmenBrochureJhIntegration.saveYwSpecialFormInfo(vo);
        return AppResponse.success();
    }

    @Operation(summary = "查询报名类别",description = "查询报名类别")
    @PostMapping(value = "/EduenrollmenJh0014", produces = "application/json;charset=UTF-8")
    public AppResponse<List<EduFormEnrollVO>> getEnrollConfigName(@RequestBody @Validated EduFormEnrollSchoolVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureJhIntegration.getEnrollConfigName(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "删除招生表单",description = "删除招生表单")
    @PostMapping(value = "/EduenrollmenJh0016", produces = "application/json;charset=UTF-8")
    public AppResponse delEnrollParam(@RequestBody @Validated EduFormEnrollKeyVO vo) {
        eduEnrollmenBrochureJhIntegration.delEnrollParam(vo);
        return AppResponse.success();
    }

    @Operation(summary = "根据学校id和当前报名类别获取可选降级类别",description = "根据学校id和当前报名类别获取可选降级类别")
    @PostMapping(value = "/EduenrollmenJh0015", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<List<SelectableConfigName>> getSelectableConfigName(@RequestBody @Validated EduFormEnrollSchoolVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureJhIntegration.getSelectableConfigName(vo));
    }

}
